${widget("common/header")}
<@libMacro.datatables tableTools="false" colVis="false" />

<div class="row">
	<div class="col-xs-12">
		<form id="queryForm" name="queryForm">
		    <div class="row">
		    	<div class="form-group col-xs-4">
					<label class="col-sm-3 control-label no-padding-left" for="applyDate">申请日期：</label>
					<div class="col-sm-9">
						<input type="text" id="applyDate" name="applyDate"  />
					</div>
				</div>
				<div class="form-group col-xs-4">
					<label class="col-sm-3 control-label no-padding-left" for="applyState">申请状态:</label>
					<div class="col-sm-9">					
					<select class="col-xs-10 col-sm-8" id="applyState" name="applyState">
					      <@libMacro.dictOptions dictType="D00017" currentValue="" />
						</select>
					</div>
				</div>
								
				<div class="form-group col-xs-4">
					<button class="btn btn-info no-padding-center" type="button" onclick="addDetail()">
						<i class="icon-on-right ace-icon fa fa-plus bigger-110"></i>
						新增
					</button>
					&nbsp; &nbsp; &nbsp;
					<button class="btn btn-info no-padding-center" type="button" onclick="queryList()">
						<i class="icon-on-right ace-icon fa fa-search bigger-110"></i>
						查询
					</button>
					&nbsp; &nbsp; &nbsp;
					<button class="btn" type="reset">
						<i class="ace-icon fa fa-undo bigger-110"></i>
						重置
					</button>
				</div>
			</div>
			
		</form>
		<div class="row">		
			<div id="dataSubListIframe" class="col-xs-12"></div>
			<div id="dataDetailIframe" />
			</div><!-- /.col -->
		</div><!-- /.ro
	</div><!-- /.col -->
</div><!-- /.row -->
</div> 
 
<script type="text/javascript">
   function queryList(){
     $("#dataSubListIframe").load("${ctx}/data/dataInfoList.do?applyDate="+$("#applyDate").val()+"&applyState="+$("#applyState").val());
     $("#dataDetailIframe").hide();
   }
   
   function addDetail(){
	   $("#dataDetailIframe").html("");
	   $("#dataDetailIframe").load("${ctx}/data/toAddPage.do");
	   $("#dataDetailIframe").show();
	   $("#dataDetailIframe").dialog("open");
   }

	var scripts = [null, null]
	$('.page-content-area').ace_ajax('loadScripts', scripts, function() {
	});
	$(function(){
				
		$( "#applyDate" ).datepicker({
			showOtherMonths: true,
			selectOtherMonths: false,
			dateFormat:'yy-mm-dd',
		});
		
		$.widget("ui.dialog", $.extend({}, $.ui.dialog.prototype, {
			_title: function(title) {
				var $title = this.options.title || '&nbsp;'
				if( ("title_html" in this.options) && this.options.title_html == true )
					title.html($title);
				else title.text($title);
			}
		}));  
		
		//我的申请信息
		$('#dataDetailIframe').dialog({
			hide:false,
			autoOpen:false,
			width: 650,
			height:550,
			modal:true,
			//bgiframe:true,
			title: "<div class='widget-header'><h4 class='smaller'><i class='ace-icon fa fa-cog green'></i>&nbsp; 申请信息</h4></div>",
			title_html: true,
			buttons: [
			            
						{
							id: "btnDModify",
							html: "<i class='ace-icon fa fa-pencil-square-o bigger-110'></i>&nbsp; 修改",
							"class" : "btn btn-primary btn-minier",
							click: function() {
								modify();
							}
						},
						{
							id: "btnDSave",
							html: "<i class='ace-icon fa fa-floppy-o bigger-110'></i>&nbsp; 保存",
							"class" : "btn btn-success btn-minier",
							click: function() {
								save();
							}
						},
						{
							id: "btnDDelete",
							html: "<i class='ace-icon fa fa-trash-o bigger-110'></i>&nbsp; 删除",
							"class" : "btn btn-danger btn-minier",
							click: function() {
								remove();
							}
						},
						{
				            id: "btnDSubmit",
				            html: "<i class='ace-icon fa fa-pencil-square-o bigger-110'></i>&nbsp; 提交正式审批",
				            "class" : "btn btn-primary btn-minier",
				            click: function() {
					            submit();
				            }
			            },
						{
							id: "btnDCancle",
							html: "<i class='ace-icon fa fa-undo bigger-110'></i>&nbsp; 取消",
							"class" : "btn btn-warning btn-minier",
							click: function() {
								cancle();
							}
						},												
						{
							id: "btnDClose",
							html: "<i class='ace-icon fa fa-times bigger-110'></i>&nbsp; 关闭",
							"class" : "btn btn-minier",
							click: function() {
								$(this).dialog("close");
							}
						}				
					],
					close: function(event, ui) {				
						if($("#operFlag").val()=="1"||$("#operFlag").val()=="3"){//1新增，3删除：重新查询列表
							$("#dataSubListIframe").load("${ctx}/data/dataInfoList.do");
							$("#dataSubListIframe").show();
						}
					}
				});
	});
</script>